package com.juc.juc_project.queue;

import java.util.concurrent.ArrayBlockingQueue;

/**
 * Created by fangjicai on 2020/4/9.
 */
public class ArrayBlockingQueueExample {

    public static void main(String[] args) throws Exception{
        ArrayBlockingQueue<Integer> integers =
                new ArrayBlockingQueue<>(4);
        integers.add(10);
        integers.add(11);
        integers.add(12);
        integers.add(13);
        //integers.add(14);  //queue  full exception
        //弹出一个值 fifo
        Integer poll = integers.poll();
        System.out.println(poll);
        Integer take = integers.take();
        System.out.println(take);
        System.out.println(integers.toString());

    }
}
